<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

<!-- RichFaces tag library declaration -->
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>


<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>Current Leads</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>

	<body>
		<f:view>

			<h:inputHidden value="#{leadController.tempVarVL}" />

			<h:form style="align: center;">

				<h:commandLink value="Log Out"
					action="#{authenticationController.logout}">
				</h:commandLink>

				<rich:spacer width="11"></rich:spacer>

				<h:commandLink value="Back to Dashboard"
					action="#{leadController.navigateToSalesAgentDashboard}"
					immediate="true">
				</h:commandLink>



				<rich:panel id="panel" header="View/Modify/Convert Lead(s)"
					style="width: 710px">

					<rich:dataTable value="#{leadController.leadList}" var="lead"
						width="700px">
						<f:facet name="header">
							<rich:columnGroup>
								<rich:column colspan="3" style=" text-align:left"> Current leads </rich:column>
							</rich:columnGroup>
						</f:facet>
						<rich:column>
							<h:outputText id="leadname" value="#{lead.firstname}"></h:outputText>
						</rich:column>
						<rich:column>
							<a4j:commandLink
								action="#{leadController.navigateToViewLeadDetail}"
								value="View Detail" limitToList="true" ajaxSingle="true">
								<f:param name="leadIdToView" value="#{lead.leadId}" />
							</a4j:commandLink>

						</rich:column>
						<rich:column>
							<a4j:commandLink
								action="#{leadController.navigateToModifyLeadDetail}"
								value="Modify Detail" limitToList="true" ajaxSingle="true">
								<f:param name="leadIdToModify" value="#{lead.leadId}" />
							</a4j:commandLink>

						</rich:column>
						
						<rich:column>
							<a4j:commandLink
								action="#{leadController.navigateToConvertLeadToOpportunity}"
								value="Convert Lead" limitToList="true" ajaxSingle="true" >
								<f:param name="leadIdToConvert" value="#{lead.leadId}" />
							</a4j:commandLink>

						</rich:column>
					</rich:dataTable>
					
				</rich:panel>

			</h:form>
		</f:view>
	</body>
</html>